<?php
/**
 * 离职员工
 */
apf_require_controller("HrAbstract");
apf_require_class('Bll_Hr_Export');

class Hr_Staff_ExportEnterController extends HrAbstractController {

    public function handle_request() {
        set_time_limit(0);
        ini_set ('memory_limit', '200M');
        $params = $this->request->get_parameters();
        if($params['start'] && $params['end']){
            $user_bll = new Bll_Hr_User();
            $start = intval(date('Ymd',strtotime($params['start'])));
            $end   = intval(date('Ymd',strtotime($params['end'])));
            $user_info = $this->get_user_info();

            $data = $user_bll->get_users_date_entry_work($start,$end,$user_info['role_list'][Const_Flow::ROLE_HR]);
            if(empty($data)){
                $this->show_tips(ERROR_USER_NO_ENTER_DATA);
            }

            $export_bll = new Bll_Hr_Export();
            $export_bll->build_enter_user($data,$start,$end);
        }
        return "Hr_Staff_ExportEnter";
    }
}